package com.duying.gdc.dao;

import java.util.Map;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;

import com.busi.framework.base.BaseDao;
import com.busi.framework.base.CC;
import com.busi.framework.base.PageSupport;
import com.busi.utils.tools.NumberTools;
import com.duying.gdc.model.GdMcImport;

public class GdMcImportDao  extends BaseDao{
	
	public Class getEntityClass(){
		return GdMcImport.class;
	}

	
	public PageSupport getPage(Map map){
		DetachedCriteria dc = DetachedCriteria.forClass(getEntityClass());
		int pageSize = 0;
		int pageNo = 1;
		if(map != null){
			Object objPageSize = map.get("pageSize");
			if(objPageSize != null){
				pageSize = NumberTools.formatObject2IntDefaultZeroNoExp(objPageSize);
			}else{
				pageSize = CC.PAGE_SIZE;
			}
			Object objPageNo = map.get("pageNo");
			if(objPageNo != null){
				pageNo = NumberTools.formatObject2IntDefaultZeroNoExp(objPageNo);
			}else{
				pageNo = 1;
			}
		}
		dc.addOrder(Order.desc("import_date"));
		return findPageByCriteria(dc , pageSize , pageNo);
	}
	
	
}
